import request from '@/utils/request'

/**
 * @description 获取交易页购买商品列表信息
 * @returns Promise
 */
export const reqTrade = () => {
  return request('/api/order/auth/trade', 'GET')
}

/**
 * @description 提交订单
 * @param params
 * @returns Promise
 */
export const reqSubmitOrder = (params: any) => {
  return request(`/api/order/auth/submitOrder?tradeNo=${params.tradeNo}`, 'POST', params)
}

/**
 * @description  获取订单支付信息
 * @param orderId 支付订单ID(通过提交订单得到)
 * @returns Promise
 */
export const reqCreateNative = (orderId: number) => {
  return request(`/api/payment/weixin/createNative/${orderId}`, 'GET')
}

/**
 * @description 查询订单的支付状态
 * @param orderId 支付订单ID
 * @returns Promise
 */
export const reqPayStatus = (orderId: number) => {
  return request(`/api/payment/weixin/queryPayStatus/${orderId}`, 'GET')
}

/**
 * @description 获取我的订单列表
 * @param page 页码
 * @param limit 每页显示数量
 * @returns
 */
export const reqOrderList = (page: string, limit: string) => {
  return request(`/api/order/auth/${page}/${limit}`, 'GET')
}
